import Vue from 'vue'
import Vuex from 'vuex'

import app from './modules/app'
import user from './modules/user'

// default router permission control
import permission from './modules/permission'

// dynamic router permission control (Experimental)
// import permission from './modules/async-router'
import getters from './getters'

Vue.use(Vuex)

export default new Vuex.Store({
  modules: {
    app,
    user,
    permission
  },
  state: {
    specsList:[],
    spects_model:'',
    skuItem:{},
    supplierList:'',
    order_id:''
  },
  mutations: {
    SET_SPECTS_LIST: (state, data) => {
      state.specsList = data
    },
    SET_SPECTS_MODEL: (state, data) => {
      console.log("state.spects_model",data)
      state.spects_model = data
    },
    SET_SKU_ITEM: (state, data) => {
      console.log("state.skuItem",data)
      state.skuItem = data
    },
    SET_ORDER_ID: (state, data) => {
      state.order_id = data
    },
    SET_PROUDCT_ID ({ commit }, data) {
      commit('SET_PROUDCT_ID',data);
    },
    SET_SUPPLIER_LIST: (state, data) => {
      // state.supplierList = data
      commit('supplierList',data);
    },
    SET_FLAG: (state, data) => {
      state.flag = data
    },
  },
  actions: {
    SET_FLAG ({ commit }, data) {
      commit('SET_FLAG',data);
    },
    SET_ORDER_ID ({ commit }, data) {
      commit('SET_ORDER_ID',data);
    },
    SET_PROUDCT_ID ({ commit }, data) {
      commit('SET_PROUDCT_ID',data);
    },
    SET_SPECTS_LIST ({ commit }, data) {
      commit('SET_SPECTS_LIST',data);
    },
    SET_SPECTS_MODEL ({ commit }, data) {
      commit('SET_SPECTS_MODEL',data);
    },
    SET_SKU_ITEM ({ commit }, data) {
      commit('SET_SKU_ITEM',data);
    },
    SET_SUPPLIER_LIST: (state, data) => {
      state.supplierList = data
    },
  },
  getters
})
